home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / ghostscript / prfont.ps < prev    next >
Text File  |  1994-08-01  |  2KB  |  98 lines

  1. %!PS-Adobe-1.0
  2. %%Creator: Eric Gisin <egisin@waterloo.csnet>
  3. %%Title: Print font catalog
  4. % Copyright (c) 1986 Eric Gisin
  5. % Copyright (C) 1992 Aladdin Enterprises, Menlo Park, CA (ghost@aladdin.com)
  6. %   Modified to print all 256 encoded characters,
  7. %     plus any unencoded characters.
  8.  
  9. % Example usages at bottom of file
  10.  
  11. /#copies 1 def
  12.  
  13. /T6 /Times-Roman findfont 6 scalefont def
  14. /Temp 64 string def
  15. /Inch {72 mul} def
  16. /Base 16 def    % char code output base
  17.  
  18. % do single character of page
  19. % output to rectangle ll=(0,-24) ur=(36,24)
  20. /DoChar {
  21.   /C exch def
  22.   /S (_) dup 0 C put def
  23.   /N F /Encoding get C get def
  24.  
  25.   % print code name, width and char name
  26.   /W F setfont S stringwidth pop def
  27.   T6 setfont
  28.   N /.notdef ne {0 -20 moveto N Temp cvs show} if
  29.   0 -12 moveto C Base Temp cvrs show (  ) show
  30.   W 0.0005 add Temp cvs 0 5 getinterval show
  31.  
  32.   % print char with reference lines
  33.   N /.notdef ne {
  34.     3 0 translate
  35.     0 0 moveto F24 setfont S show
  36.     /W S stringwidth pop def
  37.     0 -6 moveto 0 24 lineto
  38.     W -6 moveto W 24 lineto
  39.     -3 0 moveto W 3 add 0 lineto
  40.     0 setlinewidth stroke
  41.   } if
  42. } def
  43.  
  44. % print page title
  45. /DoTitle {
  46.   /Times-Roman findfont 18 scalefont setfont
  47.   18 10.5 Inch moveto FName Temp cvs show ( ) show ((24 point)) show
  48. } def
  49.  
  50. % print one block of characters
  51. /DoBlock {    % firstcode lastcode
  52.   /FirstCode 2 index def
  53.   1 exch {
  54.     /I exch def
  55.     /Xn I FirstCode sub 16 mod def /Yn I FirstCode sub 16 idiv def
  56.     gsave
  57.     Xn 36 mul 9 add Yn -56 mul 9.5 Inch add translate
  58.     I DoChar
  59.     grestore
  60.   } for
  61. } def
  62.  
  63. % print a line of character
  64. /DoLine {    % firstcode lastcode
  65.   1 exch { (_) dup 0 3 index put show pop } for
  66. } def
  67.  
  68. % print font sample page
  69. /DoFont {
  70.   /FName exch def    % font name
  71.   /F FName findfont def
  72.   /F24 F 24 scalefont def
  73.   /Line0 96 string def
  74.   /Line1 96 string def
  75.  
  76.   DoTitle (, characters 0-127) show
  77.   0 127 DoBlock
  78.   F 10 scalefont setfont
  79.   18 2.0 Inch moveto 0 63 DoLine
  80.   18 1.5 Inch moveto 64 127 DoLine
  81.   showpage
  82.  
  83.   DoTitle (, character 128-255) show
  84.   128 255 DoBlock
  85.   F 10 scalefont setfont
  86.   18 2.0 Inch moveto 128 191 DoLine
  87.   18 1.5 Inch moveto 192 255 DoLine
  88.   showpage
  89.  
  90. } def
  91.  
  92. % Do font samples
  93. % /Times-Roman DoFont            % Test (less than a minute)
  94. % /Hershey-Gothic-English DoFont    % Test (8 minutes)
  95.  
  96. % Do a complete catalog
  97. % FontDirectory {pop DoFont} forall    % All fonts (quite a long time)
  98.